package com.intcast;

import java.util.Scanner;

/*
飞机票打折优惠案例
*/
public class Demo03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入价格：");
        double price = sc.nextDouble();
        System.out.println("请输入月份：");
        int month = sc.nextInt();
        System.out.println("请输入舱室类别（经济舱、头等舱）：");
        String type = sc.next();
        double discountPrice = discountPrice(price, month, type);
        System.out.println("价格为" + price + "的机票在" + month + "优惠价为：" + discountPrice);

    }

    public static double discountPrice(double price, int month, String type) {
        if (month >= 5 && month <= 10) {
            //旺季
            switch (type) {
                case "经济舱":
                    price *= 0.85;
                    break;
                case "头等舱":
                    price *= 0.9;
                    break;
            }
        } else {
            //淡季
            switch (type) {
                case "经济舱":
                    price *= 0.65;
                    break;
                case "头等舱":
                    price *= 0.7;
                    break;
            }
        }
        return price;
    }
}
